package edu.washington.vaccine.ui;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import edu.washington.vaccine.R;
import edu.washington.vaccine.backend.Vaccine;

/*
 * Displays a specific vaccine's data.
 * The vaccine that is displayed is from a serialized object
 */
public class VaccineDataActivity extends Activity{
	@SuppressWarnings("unused")
	private Context context;
	
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.vaccine_data);
        View root = ((ViewGroup) findViewById(android.R.id.content)).getRootView();
        root.setFocusable(true);
        root.setFocusableInTouchMode(true);
        root.requestFocus();
        Bundle data = getIntent().getExtras();
        final Vaccine v = (Vaccine) data.getSerializable("vaccine");
        
        this.context = this;
        
        TextView box = (TextView) findViewById(R.id.textView3);
		box.setText("" + v.id);
		
		box = (TextView) findViewById(R.id.textView5);
		box.setText(v.name);
		
		box = (TextView) findViewById(R.id.textView7);
		box.setText(v.desc);		
        
		box = (TextView) findViewById(R.id.textView11);
		box.setText(v.schedule);
	}
	
    @Override
	public void onBackPressed() {
		Intent i = new Intent(this, VaccineListActivity.class);
		VaccineGroupActivity parentActivity = (VaccineGroupActivity) getParent();
		parentActivity.replaceContentView("vaccinelist", i);
	}
}
